#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
class MyInteger
{
private:
	int value;
public:
	MyInteger(int i=1);
	int get() const;//{ return this->value; };//后面的const保护该函数访问的对象不被改变值
	//int gett() const;
	int parselnt(const string&);
	int addition(MyInteger& );
	MyInteger& addition2(MyInteger& );
};
MyInteger& MyInteger::addition2(MyInteger& integer)
{
	this->value += integer.value;
	//return value;
	return *this;
}
MyInteger::MyInteger(int i)
{
	value = i;
	//str1 = "123";
}
int MyInteger::addition(MyInteger& integer)
{
	return integer.get() + value;
}
int MyInteger::get() const
{
	return this->value;//this 指针表示对对象进行操作，不用this表示对其他非类成员变量进行操作
}
int MyInteger::parselnt(const string& str)
{
	//return static_cast<int>(str);
	//return stoi(str);
	int j, sum=0;
	int n,i,flag=0;
	if (str[0] == '-')
	{
		i = 1;
		flag = 1;
	}
	else
	{
		i = 0;
	}
	for (; i < str.length(); i++)
	{
		
		if (isdigit(str[i]))
		{
			j = int(str[i]) - 48;
			n = str.length() - i - 1;
			sum += j * pow(10, n);
		}
		else
		{
			cout << "Input invalid" << endl;
			exit(1);
		}
	}
	return sum;
}